import request from '../utils/request';
import { coachItemData } from './coach';
import { licenceItemData } from './licence';
import { progressItemData } from './process';
import { studentItemData } from './student';

const url = 'http://localhost:8080/student';

export const changePassword = (name: string, account: any, oldPassword: any, newPassword: any) => {
    const params = new URLSearchParams();
    params.append('account', account);
    params.append('oldPassword', oldPassword);
    params.append('newPassword', newPassword);
    if (name == 'student') {
        return request({
            url: url + `/updatePassword`,
            method: 'post',
            params : params,
        });
    } else if (name == 'coach') {
        return request({
            url: url + `/update`,
            method: 'post',
        });
    } else {
        return request({
            url: url + `/update`,
            method: 'post',
        });
    }
}